package com.bank.entity;

import java.util.Date;

/**
 * 交易记录实体类
 */
public class Transaction {
    private int tradeID;
    private Date tradeDate;
    private String tradeType;
    private double tradeMoney;
    private String remark;
    private String cardID;
    private String businessNumber;
    // 全参数构造函数
    public Transaction(int tradeID, Date tradeDate, String tradeType,
                       double tradeMoney, String remark, String cardID) {
        this.tradeID = tradeID;
        this.tradeDate = tradeDate;
        this.tradeType = tradeType;
        this.tradeMoney = tradeMoney;
        this.remark = remark;
        this.cardID = cardID;
    }
    public String getBusinessNumber() {
        return businessNumber;
    }

    public void setBusinessNumber(String businessNumber) {
        this.businessNumber = businessNumber;
    }

    // 无参构造函数
    public Transaction() {}

    // Getters and Setters
    public int getTradeID() {
        return tradeID;
    }

    public void setTradeID(int tradeID) {
        this.tradeID = tradeID;
    }

    public Date getTradeDate() {
        return tradeDate;
    }

    public void setTradeDate(Date tradeDate) {
        this.tradeDate = tradeDate;
    }

    public String getTradeType() {
        return tradeType;
    }

    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    }

    public double getTradeMoney() {
        return tradeMoney;
    }

    public void setTradeMoney(double tradeMoney) {
        this.tradeMoney = tradeMoney;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getCardID() {
        return cardID;
    }

    public void setCardID(String cardID) {
        this.cardID = cardID;
    }

    // 实用方法
    public String getFormattedAmount() {
        return String.format("%.2f", tradeMoney);
    }

    public String getSummary() {
        return String.format("%s - %s (%s)",
                tradeType, getFormattedAmount(), cardID);
    }
}